﻿<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.PhanQuyen.AuthenticationForm>" %>

<%@ Import Namespace="System.Web.Mvc.Html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Sở Ngoại Vụ - Đồng Nai : Login</title>
    <%--Nhat Pham--%>
    <link href="<%=ResolveUrl("~/Content/SNVcss/style.css") %>" rel="stylesheet" type="text/css" />
    <link href="<%=ResolveUrl("~/Content/SNVcss/style.min.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%=ResolveUrl("~/Content/SNVcss/style_fixed.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%=ResolveUrl("~/Content/SNVcss/style_fixed_full.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%=ResolveUrl("~/Content/Styles/Admin.css") %>" rel="stylesheet" type="text/css"
        media="screen" />
    <script src="<%=ResolveUrl("~/Content/Scripts/jquery-1.6.2.min.js") %>" type="text/javascript"></script>
    <script type="text/javascript" src="<%=ResolveUrl("~/Content/Scripts/Authentication/Authentication.js")%>"></script>
    <script type="text/javascript" language="javascript">
        var basePath = '<%=ResolveUrl("~/") %>';
        $(document).ready(function () {
            $("#UserName").focus();
        });
        function DangNhap() {
            $("#form").attr("action", basePath + "Authentication/LayKhoaPublicChuKySo?Pass=" + $("#Password").val());
            $("#form").attr("method", "post");
            $("#form").submit();
        }
        function LayKhoa() {
            $("#form").attr("action", basePath + "Authentication/LayKhoaPublicChuKySo?Pass=" + $("#Password").val());
            $("#form").attr("method", "post");
            $("#form").submit();
        }

//        function HienThiIpad() {
//            if($("#CheckIpad").check()==true) {
//                document.getElementById("KeyIpad").style.display = '';
//                document.getElementById("MKIpad").style.display = '';
//                document.getElementById("FileKySo").style.display = 'none';
//                document.getElementById("MKKySo").style.display = 'none';
//            }
        //        }
        $(document).ready(function () {
            $("#CheckIpad").click(function () {
                
                if( $(this).is(':checked')) {
                     document.getElementById("KeyIpad").style.display = '';
                document.getElementById("MKIpad").style.display = '';
                document.getElementById("FileKySo").style.display = 'none';
                document.getElementById("MKKySo").style.display = 'none';
                }
                else {
                    document.getElementById("KeyIpad").style.display = 'none';
                    document.getElementById("MKIpad").style.display = 'none';
                    document.getElementById("FileKySo").style.display = '';
                    document.getElementById("MKKySo").style.display = '';
                }   
            });
        });
        function onpropertychange() {
            LocFile(document.getElementById("UploadControl").value);
        }
        function LocFile(file) {
            var iP = file.lastIndexOf(".");
            if (iP > 1) {
                var sExt;
                sExt = file.substr(iP);
                if (sExt.toLowerCase() != ".pfx") {
                    alert("Định dạng file không phải là khóa bí mật(Private key).\nXin mời bạn chọn lại.");
                    document.getElementById("UploadControl").focus();
                    document.getElementById("UploadControl").select();
                    return false;
                }
            }
            return true;
        }
        function ProcessXacThuc() {
            var bRet;
            sFile = document.getElementById("UploadControl").value;

            if (sFile.length == 0) {
                alert("Bạn chưa chọn chữ ký số (Private Key).");
                document.getElementById("UploadControl").focus();
                return false;
            }
            else {
                bRet = LocFile(sFile);
                if (bRet == false)
                    return false;
                else {
                    var txt1 = document.getElementById("PasswordNew").value;
                    var txt2 = document.getElementById("PasswordNewSecond").value;
                    if (txt1.length < 8) {
                        alert("Độ dài mật khẩu tối thiểu là 8 ký tự!");
                        return false;
                    }
                    else if (txt1 != txt2) {
                        alert("Mật khẩu mới giữa 2 lần nhập không hợp lệ!\nVui lòng nhập lại!");
                        return false;
                    } else {
                        $("#form").attr("action", basePath + "Authentication/ChangPassChukySo?PassOld=" + $("#Password").val() + "&&PassNew=" + $("#PasswordNew").val() + "&&PassNewSecond=" + $("#PasswordNewSecond").val());
                        $("#form").attr("method", "post");
                        $("#form").submit();
                    }
                }
            }
        }	
    </script>
</head>
<body>
    
    <form id="form" enctype="multipart/form-data" action='#'>
  <%--  <%Html.BeginForm(); %>--%>
    <input type="hidden" id="Hidden1" name="Name" />
    <div id="header" style="background: #3366ff; float: left; width: 100%">
        <!-- logo -->
        <div id="logo" style="float: left">
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                width="374" height="102" title="Sở Ngoại Vụ Tỉnh Đồng Nai">
                <param name="movie" value="<%=ResolveUrl("~/Content/Flashs/left.swf") %>" />
                <param name="quality" value="high" />
                <param name="wmode" value="transparent" />
                <embed src="<%=ResolveUrl("~/Content/Flashs/left.swf") %>" wmode="transparent" quality="high"
                    pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
                    width="374" height="102">
                </embed>
            </object>
        </div>
        <!-- user -->
        <div style="float: right">
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                width="504" height="102" title="Sở Ngoại Vụ Tỉnh Đồng Nai">
                <param name="movie" value="<%=ResolveUrl("~/Content/Flashs/right.swf") %>" />
                <param name="quality" value="high" />
                <param name="wmode" value="transparent" />
                <embed src="<%=ResolveUrl("~/Content/Flashs/right.swf") %>" wmode="transparent" quality="high"
                    pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
                    width="504" height="102">
                </embed>
            </object>
        </div>
    </div>
    <!-- content -->
    <div class="content_login">
        <!--Left_login -->
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td class="left_content_login" rowspan="3">
                </td>
                <td class="top_center_loginChangePass">
                  <b style="font-size: 18px;"> THÂY ĐỔI MẬT KHẨU </b>
                </td>
                <td rowspan="3" class="right_login">                    
                </td>
            </tr>
            <tr>
                <td class="center_login" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0" style="line-height: 25px;">
                        <tr>
                            <td>
                                &nbsp;
                            </td>

                            <td>
                                <div class="red_bold" id="AuthenticationMessage">
                                    <%= Model.IsAuthenticationError ? Model.LoginMessage : String.Empty%>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td nowrap="nowrap">
                                <b>Chọn chử ký số </b>&nbsp;
                            </td>
                            <td>
                             <input type="file" id="UploadControl" name="UploadControl" onchange="return onpropertychange();"/>
                            </td>
                        </tr>
                        <tr>
                             <td style="text-align: right">
                                <b>Mật khẩu củ </b>&nbsp;
                            </td>
                            <td>
                                <%=Html.Password("Password", Model.Password, new { @size = 28, @value = "", @onkeypress = "if (event.keyCode==13) { return DoLogin(); }", Style = "width:150px" })%>
                            </td>
                        </tr>
                         <tr>
                            <td style="text-align: right"  nowrap="nowrap">
                                <b>Mật khẩu mới</b>&nbsp;
                            </td>
                            <td>
                                <%=Html.Password("PasswordNew", Model.Password, new { @size = 28, @value = "", @onkeypress = "if (event.keyCode==13) { return DoLogin(); }", Style = "width:150px" })%>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: right"  nowrap="nowrap">
                                <b>Nhập lại mật khẩu </b>&nbsp;
                            </td>
                            <td>
                                <%=Html.Password("PasswordNewSecond", Model.Password, new { @size = 28, @value = "", @onkeypress = "if (event.keyCode==13) { return DoLogin(); }", Style = "width:150px" })%>
                            </td>
                        </tr>
                    </table>
                    <div style="padding-top: 20px; margin-left: 70px">
                        <input type="button" style="background: url(<%= ResolveUrl("~/Content/ImagesAdmin/button_submit.jpg")%>);
                            border: 0; width: 105px; height: 28px; color: #FFF; cursor: pointer" value="Thây đổi"
                            onclick="ProcessXacThuc();" />
                              <input type="button" style="background: url(<%= ResolveUrl("~/Content/ImagesAdmin/button_submit.jpg")%>);
                            border: 0; width: 105px; height: 28px; color: #FFF; cursor: pointer" value="Lấy Khóa"
                            onclick="LayKhoa();" />
                    </div>
                </td>
            </tr>
            <tr>
                <td class="bottom_form_login" colspan="2">
                </td>
            </tr>
            <tr>
                <td></td>
                <td colspan="2">
                    Trụ sở: Số 7, Võ Thị Sáu, phường Quyết Thắng, Biên Hòa , Đồng Nai.<br />
                    Điện thoại: 0613.842584 - 0613.843232 - 0613. 842587<br />
                    Fax: 0613.842935; Email: dofadn@vnn.vn<br />
                </td>
            </tr>
        </table>
    </div>
    </form>
   <%-- <%Html.EndForm(); %>--%>
</body></html>
